package tx.oopa.circuit.port;

/**
 * Abstract class which should be inherited by ports which have a single
 * input value. This class handles the input value and eventually calls
 * the method which actually performs the logical function.
 * 
 * @author Xander van Rijn
 *
 */
public abstract class AbstractSinglePort extends AbstractPort {

	protected Boolean input = null;

	protected AbstractSinglePort() {}

	protected AbstractSinglePort(String ID) {
		super(ID);
	}

	/**
	 * {@inheritDoc}
	 */
	public Boolean setInput(Boolean input) {
		if(input == null) {
			throw new IllegalArgumentException("Input value cannot be null.");
		}
		this.input = input;      
		return this.performLogicalFunction();
	}
}
